<ul class="random-attachments">
	<?php $new_query = new WP_Query('&showposts=4'); ?>
	<?php while ($new_query->have_posts()) : $new_query->the_post(); ?>
		<?php
	$args = array(
		'post_type' => 'attachment',
		'numberposts' => 1,
		'orderby' => rand,
		'status' => 'publish',
		'post_mime_type' => 'image',
		'parent' => $post->ID
	);
	$attachments = get_posts($args);
	if ($attachments) {
		foreach ($attachments as $attachment) {
			echo '<li>';
			echo wp_get_attachment_link($attachment->ID, 'thumbnail', true, '');
			echo '</li>';
		}
	}
	?>
<?php endwhile; ?>
</ul>